<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>家属管理 - 疫苗预约系统</title>
    <link rel="stylesheet" href="../css/common.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
</head>
<body>
    <div class="main-container">
        <!-- 侧边栏 -->
        <div class="sidebar">
            <div class="sidebar-header">
                <i class="fas fa-syringe"></i>
                <h2>疫苗预约系统</h2>
                <p>普通用户</p>
            </div>
            <nav class="sidebar-menu">
                <a href="home.html" class="menu-item">
                    <i class="fas fa-home"></i>
                    <span>首页</span>
                </a>
                <a href="family.html" class="menu-item active">
                    <i class="fas fa-users"></i>
                    <span>家属管理</span>
                </a>
                <a href="appointment.html" class="menu-item">
                    <i class="fas fa-calendar-check"></i>
                    <span>预约管理</span>
                </a>
                <a href="vaccine.html" class="menu-item">
                    <i class="fas fa-vial"></i>
                    <span>疫苗查询</span>
                </a>
                <a href="site.html" class="menu-item">
                    <i class="fas fa-hospital"></i>
                    <span>接种点查询</span>
                </a>
                <a href="profile.html" class="menu-item">
                    <i class="fas fa-user-circle"></i>
                    <span>个人中心</span>
                </a>
            </nav>
        </div>

        <!-- 主内容区域 -->
        <div class="main-content">
            <!-- 顶部导航栏 -->
            <div class="top-navbar">
                <div class="navbar-left">
                    <h1>家属管理</h1>
                </div>
                <div class="navbar-right">
                    <div class="user-info">
                        <div class="user-avatar" id="userAvatar">U</div>
                        <span class="user-name" id="userName">用户</span>
                    </div>
                    <button class="btn-logout" onclick="handleLogout()">
                        <i class="fas fa-sign-out-alt"></i> 退出登录
                    </button>
                </div>
            </div>

            <!-- 内容区域 -->
            <div class="content-area">
                <!-- 页面标题 -->
                <div class="page-header">
                    <h2 class="page-title">家属管理</h2>
                    <p class="page-subtitle">管理您的家属信息，为家属预约疫苗接种</p>
                </div>

                <!-- 家属列表卡片 -->
                <div class="card">
                    <div class="card-header">
                        <h3 class="card-title">家属列表</h3>
                        <button class="btn btn-primary" onclick="showAddFamilyModal()">
                            <i class="fas fa-plus"></i> 添加家属
                        </button>
                    </div>
                    <div class="card-body">
                        <div class="table-container">
                            <table>
                                <thead>
                                    <tr>
                                        <th>姓名</th>
                                        <th>年龄</th>
                                        <th>身份证号</th>
                                        <th>关系</th>
                                        <th>操作</th>
                                    </tr>
                                </thead>
                                <tbody id="familyTableBody">
                                    <tr>
                                        <td colspan="5" style="text-align: center; padding: 40px; color: #999;">
                                            <i class="fas fa-users" style="font-size: 48px; margin-bottom: 10px; display: block;"></i>
                                            暂无家属信息，点击"添加家属"按钮添加
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- 添加家属模态框 -->
    <div class="modal" id="addFamilyModal">
        <div class="modal-content">
            <div class="modal-header">
                <h3 class="modal-title">添加家属</h3>
                <button class="modal-close" onclick="closeAddFamilyModal()">&times;</button>
            </div>
            <div class="modal-body">
                <form id="addFamilyForm">
                    <div class="form-group">
                        <label>姓名 <span style="color: red;">*</span></label>
                        <input type="text" id="familyName" placeholder="请输入家属姓名" required>
                    </div>
                    <div class="form-row">
                        <div class="form-group">
                            <label>年龄 <span style="color: red;">*</span></label>
                            <input type="number" id="familyAge" placeholder="请输入年龄" min="0" max="150" required>
                        </div>
                        <div class="form-group">
                            <label>关系 <span style="color: red;">*</span></label>
                            <select id="familyRelation" required>
                                <option value="">请选择关系</option>
                                <option value="0">父亲</option>
                                <option value="1">母亲</option>
                                <option value="2">配偶</option>
                                <option value="3">子女</option>
                                <option value="4">兄弟姐妹</option>
                                <option value="5">其他</option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label>身份证号 <span style="color: red;">*</span></label>
                        <input type="text" id="familyIdNum" placeholder="请输入身份证号" maxlength="18" required>
                        <small style="color: #999; font-size: 12px;">请输入15位或18位身份证号</small>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button class="btn btn-secondary" onclick="closeAddFamilyModal()">取消</button>
                <button class="btn btn-primary" onclick="handleAddFamily()">
                    <i class="fas fa-save"></i> 保存
                </button>
            </div>
        </div>
    </div>

    <script src="../js/common.js"></script>
    <script src="js/family.js"></script>
</body>
</html>

